﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using BBICMS.Model;
using System.ComponentModel.DataAnnotations.Schema;

namespace BBICMS.Repository.Configuration
{
   public  class ColorLangMap : EntityTypeConfiguration<ColorLang>
    {
       public ColorLangMap()
       {
           this.HasKey(p => p.Id);
            this.Property(p => p.Id)
            .HasColumnName("Id")
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.ToTable("ColorLangs");

            this.Property(p => p.Name).HasMaxLength(50).IsOptional();
            this.Property(p => p.CultureName).HasMaxLength(50).IsRequired();
           this.Property(p => p.ColorId).IsRequired();        


            this.HasRequired(l => l.Color)
           .WithMany(l => l.ColorLangs)
           .HasForeignKey(l => l.ColorId)
           .WillCascadeOnDelete(true);            

        }
    }
}
